import Mock from 'mockjs'

const data = Mock.mock({
  'items|30': [{
    id: '@id',
    name: '@sentence(1, 2)',
    'status|1': ['new', 'success', 'failed', 'deleted'],
    author: 'name',
    create_time: '@datetime',
    pageviews: '@integer(300, 5000)'
  }]
})

// const sutieData = Mock.mock({
//   'items|3': [{
//     id: '@id',
//     name: '@sentence(1, 2)',
//     description: '@sentence(5,10)'
//   }]
// })

const sutieData = Mock.mock({
  'items': [{
    id: '1',
    name: '用例集合1',
    description: '用例验证用户相关的用例'
  },
  {
    id: '2',
    name: '购物车相关',
    description: '用例购物车相关的用例'
  },
  {
    id: '3',
    name: '订单相关',
    description: '用例验证订单相关的用例'
  }]
})

export default [
  {
    url: '/vue-admin-template/testcase/list',
    type: 'get',
    response: config => {
      const items = data.items
      return {
        code: 20000,
        data: {
          total: items.length,
          items: items
        }
      }
    }
  },
  {
    url: '/vue-admin-template/testcase/suite',
    type: 'get',
    response: config => {
      const items = sutieData.items
      return {
        code: 20000,
        data: {
          total: items.length,
          items: items
        }
      }
    }
  }
]
